package com.supply;

import java.util.*;

/**
 * @author : wushikai
 * <p>
 * date : 2021/8/6
 */
public class EnumDemo {



    public static void main(String args[]) {
        Enumeration<String> days;
        Vector<String> dayNames = new Vector< >();
        dayNames.add("Sunday");
        dayNames.add("Monday");
        dayNames.add("Tuesday");
        dayNames.add("Wednesday");
        dayNames.add("Thursday");
        dayNames.add("Friday");
        dayNames.add("Saturday");
        days = dayNames.elements();
        while (days.hasMoreElements()){
            System.out.println(days.nextElement());
        }

        Vector<String> companyList = new Vector<>();
        companyList.add("Microsoft");
        companyList.add("google");
        companyList.add("Apple");
        Enumeration<String> companies  = companyList.elements() ;

        System.out.println(companies.nextElement());  //Microsoft
        System.out.println(companies.nextElement());  //google
        System.out.println(companies.nextElement());  //Apple
        System.out.println(companies.nextElement());  //报异常, 因为指针移动了, 指向了  null


    }
}
